<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<div id="jobModal" class="modal fade" tabindex="-1" role="dialog"
	aria-hidden="true">
	<div class="modal-dialog modal-lg">
		<div class="modal-content">
			<form class="form-horizontal" name="jobForm" ng-submit="saveJob()">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title">
						<i class="mark"></i> <span>新增修改任务</span>
					</h4>
				</div>
				<div class="modal-body">
					<div class="form-group has-feedback"
						ng-class="{'has-error' : jobForm.name.$invalid && jobForm.name.$dirty, 
							'has-warning': jobForm.name.$invalid && !jobForm.name.$dirty}">
						<label class="col-md-3 control-label control-label-sm necessary-option">任务名称:</label>
						<div class="col-md-9">
							<input type="text" class="form-control input-sm" id="jobName"
								ng-model="jobVO.name" name="name" placeholder="格式：J_应用名_模块名"
								ng-pattern="/^J_\w+$/" ng-required="true" ng-maxlength="250"/> 
							<span
								class="glyphicon glyphicon-remove form-control-feedback"
								aria-hidden="true" 
								ng-show="jobForm.name.$invalid && jobForm.name.$dirty"></span>
							<span
								class="glyphicon glyphicon-warning-sign form-control-feedback"
								aria-hidden="true"
								ng-show="jobForm.name.$invalid && !jobForm.name.$dirty"></span>
						</div>
					</div>
					<div class="form-group has-feedback"
						ng-class="{'has-error' : jobForm.jobClass.$invalid && jobForm.jobClass.$dirty, 
							'has-warning': jobForm.jobClass.$invalid && !jobForm.jobClass.$dirty}">
						<label class="col-md-3 control-label control-label-sm necessary-option">任务实现类路径:</label>
						<div class="col-md-9">
							<input type="text" class="form-control input-sm"
								ng-model="jobVO.jobClass" name="jobClass"
								ng-pattern="/^(hn.)?com(\.\w+)+$/" ng-required="true"
								placeholder="格式：com.xxx.xxx.类名" ng-maxlength="250"/> 
							<span
								class="glyphicon glyphicon-remove form-control-feedback"
								aria-hidden="true" 
								ng-show="jobForm.jobClass.$invalid && jobForm.jobClass.$dirty"></span>
							<span
								class="glyphicon glyphicon-warning-sign form-control-feedback"
								aria-hidden="true"
								ng-show="jobForm.jobClass.$invalid && !jobForm.jobClass.$dirty"></span>
						</div>
					</div>
					<div class="form-group has-feedback">
						<div ng-class="{'has-error' : jobForm.jobGroupId.$invalid && jobForm.jobGroupId.$dirty, 
								'has-warning': jobForm.jobGroupId.$invalid && !jobForm.jobGroupId.$dirty}">
							<label class="col-md-3 control-label control-label-sm necessary-option">任务组:</label>
							<div class="col-md-3">
								<input select2 type="text" class="form-control input-sm"
									name="jobGroupId" ng-model="jobVO.jobGroupId"
									select2-model="jobVO.jobGroup" config="jobGroupSelectConfig"
									ng-required="true" />
								<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobForm.jobGroupId.$invalid && jobForm.jobGroupId.$dirty"></span>
							</div>
						</div>

						<div ng-class="{'has-error' : jobForm.priority.$invalid && jobForm.priority.$dirty, 
								'has-warning': jobForm.priority.$invalid && !jobForm.priority.$dirty}">
							<label class="col-md-3 control-label control-label-sm necessary-option">优先级:</label>
							<div class="col-md-3">
								<input type="number" class="form-control input-sm"
									name="priority" ng-model="jobVO.priority" ng-required="true"
									ng-pattern="/^[1-5]$/" placeholder="1~5之间的整数" /> 
								<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobForm.priority.$invalid && jobForm.priority.$dirty"></span>
								<span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"
									ng-show="jobForm.priority.$invalid && !jobForm.priority.$dirty"></span>
							</div>
						</div>
					</div>
					<div class="form-group has-feedback">
						<div ng-class="{'has-error' : jobForm.jobType.$invalid && jobForm.jobType.$dirty, 
								'has-warning': jobForm.jobType.$invalid && !jobForm.jobType.$dirty}">
							<label class="col-md-3 control-label control-label-sm necessary-option">任务类型:</label>
							<div class="col-md-3">
								<input select2 type="text" class="form-control input-sm"
									name="jobType" ng-model="jobVO.jobType"
									config="jobTypeSelectConfig" ng-required="true" />
								<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobForm.jobType.$invalid && jobForm.jobType.$dirty"></span>
								<span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"
									ng-show="jobForm.jobType.$invalid && !jobForm.jobType.$dirty"></span>
							</div>
						</div>
						<div
							ng-class="{'has-error' : jobForm.jobRepeatType.$invalid && jobForm.jobRepeatType.$dirty, 
								'has-warning': jobForm.jobRepeatType.$invalid && !jobForm.jobRepeatType.$dirty}">
							<label class="col-md-3 control-label control-label-sm necessary-option">周期类型:</label>
							<div class="col-md-3">
								<input select2 type="text" class="form-control input-sm"
									name="jobRepeatType" ng-model="jobVO.jobRepeatType"
									config="repeatTypeSelectConfig" ng-required="true" />
								<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobForm.jobRepeatType.$invalid && jobForm.jobRepeatType.$dirty"></span>
							</div>
						</div>
					</div>
					<div class="form-group has-feedback" ng-show="jobVO.jobRepeatType == 'NORMAL'">
						<div ng-class="{'has-error' : jobForm.repeatCount.$invalid && jobForm.repeatCount.$dirty, 
								'has-warning': jobForm.repeatCount.$invalid && !jobForm.repeatCount.$dirty}">
							<label class="col-md-3 control-label control-label-sm necessary-option">重复次数:</label>
							<div class="col-md-3">
								<input type="number" class="form-control input-sm"
									name="repeatCount" ng-model="jobVO.repeatCount"
									ng-required="jobVO.jobRepeatType == 'NORMAL'" placeholder="-1代表无限次数" />
								<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobForm.repeatCount.$invalid && jobForm.repeatCount.$dirty"></span>
								<span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"
									ng-show="jobForm.repeatCount.$invalid && !jobForm.repeatCount.$dirty"></span>
							</div>
						</div>
						<div ng-class="{'has-error' : jobForm.repeatInterval.$invalid && jobForm.repeatInterval.$dirty, 
								'has-warning': jobForm.repeatInterval.$invalid && !jobForm.repeatInterval.$dirty}">
							<label class="col-md-3 control-label control-label-sm necessary-option">时间间隔:</label>
							<div class="col-md-3">
								<input type="number" class="form-control input-sm"
									name="repeatInterval" ng-model="jobVO.repeatInterval"
									ng-required="jobVO.jobRepeatType == 'NORMAL'" placeholder="单位毫秒" />
								<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobForm.repeatInterval.$invalid && jobForm.repeatInterval.$dirty"></span>
								<span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"
									ng-show="jobForm.repeatInterval.$invalid && !jobForm.repeatInterval.$dirty"></span>
							</div>
						</div>
					</div>
					<div class="form-group has-feedback">
						<div
							ng-class="{'has-error' : jobForm.executeTimeout.$invalid && jobForm.executeTimeout.$dirty, 
								'has-warning': jobForm.executeTimeout.$invalid && !jobForm.executeTimeout.$dirty}">
							<label class="col-md-3 control-label control-label-sm necessary-option">超时时间:</label>
							<div class="col-md-3">
								<input type="number" class="form-control input-sm" name="executeTimeout" ng-model="jobVO.executeTimeout"
									ng-required="true" placeholder="-1代表无超时:单位毫秒" />
								<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobForm.executeTimeout.$invalid && jobForm.executeTimeout.$dirty"></span>
								<span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"
									ng-show="jobForm.executeTimeout.$invalid && !jobForm.executeTimeout.$dirty"></span>
							</div>
						</div>
						<div
							ng-class="{'has-error' : jobForm.jobTimeoutPolicy.$invalid && jobForm.jobTimeoutPolicy.$dirty, 
								'has-warning': jobForm.jobTimeoutPolicy.$invalid && !jobForm.jobTimeoutPolicy.$dirty}">
							<label class="col-md-3 control-label control-label-sm necessary-option">超时策略:</label>
							<div class="col-md-3">
								<input select2 type="text" class="form-control input-sm" name="jobTimeoutPolicy" ng-model="jobVO.jobTimeoutPolicy"
									config="jobTimeoutPolicySelectConfig" ng-required="true" />
								<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobForm.jobTimeoutPolicy.$invalid && jobForm.jobTimeoutPolicy.$dirty"></span>
								<span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"
									ng-show="jobForm.jobTimeoutPolicy.$invalid && !jobForm.jobTimeoutPolicy.$dirty"></span>
							</div>
						</div>
					</div>
					
					<div class="form-group has-feedback">
						<div ng-class="{'has-error' : jobForm.jobMisfireInstruction.$invalid && jobForm.jobMisfireInstruction.$dirty, 
								'has-warning': jobForm.jobMisfireInstruction.$invalid && !jobForm.jobMisfireInstruction.$dirty}">
							<label class="col-md-3 control-label control-label-sm necessary-option">错过执行恢复策略:</label>
							<div class="col-md-3">
								<input select2 type="text" class="form-control input-sm" name="jobMisfireInstruction" ng-model="jobVO.jobMisfireInstruction"
									config="misfireInstructionSelectConfig" ng-required="true" />
								<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobForm.jobMisfireInstruction.$invalid && jobForm.jobMisfireInstruction.$dirty"></span>
								<span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"
									ng-show="jobForm.jobMisfireInstruction.$invalid && !jobForm.jobMisfireInstruction.$dirty"></span>
							</div>
						</div>
						<div ng-class="{'has-error' : jobForm.resetDeathDelayTime.$invalid && jobForm.resetDeathDelayTime.$dirty, 
									'has-warning': jobForm.resetDeathDelayTime.$invalid && !jobForm.resetDeathDelayTime.$dirty}">
							<label class="col-md-3 control-label control-label-sm necessary-option">死任务自动复重恢置时间:</label>
							<div class="col-md-3">
								<input type="text" class="form-control input-sm" name="resetDeathDelayTime" ng-model="jobVO.resetDeathDelayTime"
									ng-required="true" placeholder="-1代表不恢复:单位毫秒" />
								<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobForm.resetDeathDelayTime.$invalid && jobForm.resetDeathDelayTime.$dirty"></span>
								<span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"
									ng-show="jobForm.resetDeathDelayTime.$invalid && !jobForm.resetDeathDelayTime.$dirty"></span>
							</div>
						</div>
					</div>
					
					<div class="form-group has-feedback">
						<div ng-show="jobVO.jobRepeatType == 'CRON'">
							<div ng-class="{'has-error' : jobForm.cronExpression.$invalid && jobForm.cronExpression.$dirty, 
									'has-warning': jobForm.cronExpression.$invalid && !jobForm.cronExpression.$dirty}">
								<label class="col-md-3 control-label control-label-sm necessary-option">Cron表达式:</label>
								<div class="col-md-3">
									<input type="text" class="form-control input-sm"
										name="cronExpression" ng-model="jobVO.cronExpression" ng-required="jobVO.jobRepeatType == 'CRON'" />
									<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
										ng-show="jobForm.cronExpression.$invalid && jobForm.cronExpression.$dirty"></span>
									<span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"
										ng-show="jobForm.cronExpression.$invalid && !jobForm.cronExpression.$dirty"></span>
								</div>
							</div>
						</div>
						
						<div ng-class="{'has-error' : jobForm.bufferSizeLimit.$invalid && jobForm.bufferSizeLimit.$dirty, 
								'has-warning': jobForm.bufferSizeLimit.$invalid && !jobForm.bufferSizeLimit.$dirty}">
							<label class="col-md-3 control-label control-label-sm necessary-option">子任务待执行数量上限:</label>
							<div class="col-md-3">
								<input type="number" class="form-control input-sm" name="bufferSizeLimit" ng-model="jobVO.bufferSizeLimit"
									ng-required="true" />
								<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobForm.bufferSizeLimit.$invalid && jobForm.bufferSizeLimit.$dirty"></span>
								<span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"
									ng-show="jobForm.bufferSizeLimit.$invalid && !jobForm.bufferSizeLimit.$dirty"></span>
							</div>
						</div>
					</div>
					
					<div class="form-group">
						<label class="col-md-3 control-label control-label-sm">描述说明:</label>
						<div class="col-md-8">
							<textarea rows="5" cols="77" ng-model="jobVO.description"></textarea>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<div class="modal-footer-button">
						<button type="button" class="btn btn-sm btn-default"
							data-dismiss="modal">取消</button>
						<button type="submit" class="btn btn-sm btn-blue">确认</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
